package com.ruoyi.video.server.push;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.video.domain.VideoCamera;
import lombok.Data;


/**
 * 对外推送消息实体
 */
@Data
public class PushMessage {
    public static final String DEVICE_ONLINE="online";
    public static final String DEVICE_OFFLINE="offline";
    public static final String DEVICE_ADD = "add";
    public static final String DEVICE_REMOVE = "remove";

    private String id;
    private String action;
    private Long cameraId;
    private VideoCamera info;
    private String time;

    /**
     * 快速创建消息体
     * @param action
     * @param cameraId
     * @param videoCamera
     * @return
     */
    public static PushMessage create(String action, Long cameraId, VideoCamera videoCamera){
        PushMessage message = new PushMessage();
        message.id = UUID.fastUUID().toString(true);
        message.action = action;
        message.cameraId = cameraId;
        message.info = videoCamera;
        message.time = DateUtils.dateTimeNow();
        return message;
    }
}
